<template>
	<view class="container">
		<view class="topbox">
		</view>
		<view class="strip"></view>
		<view class="paycard">
			<view class="moneybox">
				<view class="moneynum">
					<view class="num">{{listdata.money}}</view>
					<view class="text">缴费金额(元）</view>
				</view>
				<view class="mini-icon">
					<image :src="listdata.image" class="icon-img"></image>
				</view>
			</view>
		</view>
		<view class="paycard1" v-for="(item,index) in listdata.dataList" :key="index">
			<view class="infolist" v-for="(items,indexs) in item" :key="indexs">
				<view class="text4">{{items.name}}</view>
				<view class="text4">{{items.value}}</view>
			</view>
		</view>
		<button type="primary" v-if="type =='property' || type =='custom_payment'  "  :style="btn_style" class="btn" @click="btnpay">{{btntext}}</button>
	</view>
</template>

<script>
	var common = require('../../../utils/common.js');
	var app = getApp();
	var _this;
	const getunpaidmentlist = () => {
		common.post('HouseApi&a=property_unpaid_pay_info', {
			village_id: _this.village_id,
			pigcms_id: _this.pigcms_id,
			bind_id: _this.bind_id,
			pay_type: _this.type
		}, data => {
			console.log('++++', data)
			_this.listdata = data;
			_this.btntext = data.pay_type_name;
			if(_this.btntext){
				_this.btntext = "去预存" + _this.btntext
			}else{
				_this.btntext = "去预存费用"
			}
		});
	};
	
	export default {
		data() {
			return {
				listdata: {},
				village_id: 0,
				pigcms_id: 0,
				actcolor:'',
				btn_style:'',
				bind_id: 0,
				type: '',
				btntext: '',
			}
		},
		onShow() {
			// #ifdef H5
				common.hideWxShare()
			// #endif
		},
		onLoad(options) {
			_this = this;
			console.log("33333333",options)
			_this.type = options.type;
			_this.bind_id = options.bind_id;
			// #ifdef H5
			console.log('准备跳小程序页', _this);
			common.webToMiniapp(_this.route, options, 'redirect')
			// #endif
			
			common.setMainColor(_this, function(config) {
				_this.actcolor = config.config.mobile_head_color
				_this.btn_style = 'background-color: ' + _this.actcolor + ';box-shadow:0px 30rpx 30rpx -30rpx ' + _this.actcolor + ';';
				
				const res = uni.getStorageSync('village_key');
				if (res) {
					_this.village_id = res.village_id;
					_this.pigcms_id = res.pigcms_id;
					_this.village_name = res.village_name;
				};
				
				// if(options.village_id && options.village_id != _this.village_id){
				// 	common.post('HouseApi&a=search_village', {
				// 		village_id: options.village_id
				// 	}, data => {
				// 		_this.village_logo = data.village_logo ? data.village_logo : data.wechat_share_img;
				// 		_this.village_id = options.village_id;
				// 		_this.village_name = options.village_name;
				// 		var res = {
				// 			village_id: _this.village_id,
				// 			village_name: _this.village_name,
				// 			village_logo: _this.village_logo
				// 		};
				// 		if(options.pigcms_id){
				// 			res.pigcms_id = options.pigcms_id;
				// 			_this.pigcms_id = options.pigcms_id;
				// 		}
				// 		uni.setStorageSync('village_key', res);
						
				// 		getlifePaylist();
				// 	});
				// 	return false;
				// }
				getunpaidmentlist()
			});
		},
		methods: {
			btnpay(){
				if(_this.type == "custom_payment"){
					uni.navigateTo({
						url: "/pages/village/my/healthManagementfee?type=" + _this.type + '&bind_id=' + _this.bind_id
					})
				}else{
					uni.navigateTo({
						url: "/pages/village/my/lifepayment"
					})
				}
			},
		},
	}
</script>

<style>
	page {
		background: rgb(245, 245, 245);
	}

	.container {
		margin: 0;
		padding: 0;
	}
	.topbox {
		width: 100%;
		height: 200rpx;
		background-color: #2681f3;
	}
	.strip {
		margin: 0 16rpx;
		height: 20rpx;
		background-color: #116cde;
		opacity: 0.8;
		border-radius: 10rpx;
		margin-top: -150rpx;
		z-index: 99;
	}
	.paycard {
		margin: 0 30rpx;
		background-color: #ffffff;
		border-radius: 5rpx;
		margin-top: -8rpx;
		overflow: hidden;
		padding: 50rpx 30rpx;
	}
	.moneybox{
		display: flex;
		flex-direction: row;
		justify-content: space-between;
		align-items: center;
	}
	.moneybox1{
		margin-top: 20rpx;
		display: flex;
		flex-direction: row;
		justify-content: flex-start;
		align-items: center;
	}
	.moneynum {
		display: flex;
		flex-direction: column;
		justify-content: center;
	}
	.moneynum1 {
		display: flex;
		flex-direction: column;
		justify-content: center;
		flex-grow: 3.5;
	}
	.num {
		font-size: 52rpx;
		font-weight: normal;
		font-stretch: normal;
		line-height: 60rpx;
		letter-spacing: 0rpx;
		color: #333333;
	}
	.text {
		font-size: 26rpx;
		font-weight: normal;
		font-stretch: normal;
		line-height: 60rpx;
		letter-spacing: 0rpx;
		color: #999999;
	}
	.num1 {
		font-size: 36rpx;
		font-weight: normal;
		font-stretch: normal;
		line-height: 60rpx;
		letter-spacing: 0rpx;
		color: #333333;
	}
	.text1 {
		font-size: 24rpx;
		font-weight: normal;
		font-stretch: normal;
		line-height: 60rpx;
		letter-spacing: 0rpx;
		color: #999999;
	}
	.paycard1 {
		margin: 0 30rpx;
		background-color: #ffffff;
		border-radius: 5rpx;
		margin-top: 10rpx;
		overflow: hidden;
		padding: 50rpx 30rpx;
	}
	.mini-icon {
		width: 80rpx;
		height: 80rpx;
	}
	.icon-img {
		width: 100%;
		height: 100%;
	}
	.infolist {
		display: flex;
		flex-direction: row;
		justify-content: space-between;
		align-items: center;
		border-bottom: 2rpx solid #f0f0f0;
	}
	.infolist:last-child {
		border-bottom: 0rpx solid #f0f0f0;
	}
	.text4 {
		font-size: 24rpx;
		font-weight: normal;
		font-stretch: normal;
		line-height: 80rpx;
		letter-spacing: -1rpx;
		color: #ababab;
	}
	.text2 {
		font-size: 24rpx;
		font-weight: normal;
		font-stretch: normal;
		line-height: 40rpx;
		letter-spacing: 0rpx;
		color: #999999;
		margin: 30rpx 40rpx 0rpx 40rpx;
	}
	.text3 {
		font-size: 24rpx;
		font-weight: normal;
		font-stretch: normal;
		line-height: 40rpx;
		letter-spacing: 0rpx;
		color: #999999;
		margin: 0rpx 40rpx 30rpx 40rpx;
	}
	
	.btn {
		font-size: 32rpx;
		font-weight: normal;
		font-stretch: normal;
		line-height: 90rpx;
		letter-spacing: 0px;
		color: #ffffff;
		background-color: #2681f3;
		border-radius: 44rpx;
		margin: 0rpx 100rpx;
		margin-top: 100rpx;
		border: 0rpx;
	}
	
</style>
